﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Vit.PlugIn.Lucene.Converters;

namespace Vit.PlugIn.Lucene
{
    public class DocumentInfo
    {
        public DocumentInfo(SegmentInfo segment)
        {
            this.Segment = segment;
            Fields = new List<FieldInfo>();
        }

        private IEntityAccessor accessor;
        public IEntityAccessor EntityAccessor 
        {
            get
            {
                if (accessor == null)
                    accessor = new ReflectEntityAccessor(Segment.ObjectType);
                return accessor;
            }
            set
            {
                accessor = value;
            }
        }

        public List<FieldInfo> Fields { get; private set; }

        public SegmentInfo Segment { get; private set; }
    }
}
